#include <iostream>
using namespace std;

class temperature
{
public:
        void setcelsius(double c)
        {
            if(celsius>-273.15)
            {
                celsius = c;
                cout << "设置温度成功" << endl;
                cout << "当前温度(摄氏度)为：" << celsius << endl;
            }else
            {
                cout << "设置温度失败" << endl;
            }
        }
        // 获取华氏温度
        void getfahrenheit()
        {
            double f = celsius * 9 / 5 + 32;
            cout << "当前温度(华氏度)为：" << f << endl;
        }
        // 返回开尔文温度
        void getkelvin()
        {
            double k = celsius + 273.15;
            cout << "当前温度(开尔文)为：" << k << endl;
        }

private:
        double celsius; // 摄氏度
};

int main ()
{
    temperature t1;
    t1.setcelsius(30);
    t1.getfahrenheit();
    t1.getkelvin();
    return 0;
}